#ifndef YEP_UI_BUTTON_BASE_HPP
#define YEP_UI_BUTTON_BASE_HPP

#include "Widget.hpp"
#include "ButtonStatus.hpp"
#include "ActionBase.hpp"

namespace yep
{

/**
 * @brief A clickable button.
 **/
class ButtonBase: public Widget
{
public:

	/**
	 * @brief Creates a new button
	 **/
	ButtonBase(const string& text = "");
	/**
	 * @brief Called when it is drawn on screen
	 **/
	void onDraw(SDL_Surface *screen);
	/**
	 * @brief Occurs when an event must be handled.
	 *
	 * It must at least receive SDL_MOUSEBUTTONDOWN e SDL_MOUSE_BUTTONUP
	 **/
	bool onEvent(SDL_Event & event);
	/**
	 * @brief Occurs when the mouse press a button.
	 **/
	bool onClickDown(SDL_MouseButtonEvent & buttonEvent);
	/**
	 * @brief Called when a action is fired
	 **/
	virtual void onAction();
	/**
	 * @brief Enlarge the size to fit text.
	 **/
	virtual void autoResize();
	/**
	 * @brief Returns the status
	 **/
	ButtonStatus status() const;
	/**
	 * @brief Changes the status
	 **/
	void status(ButtonStatus value);
	/**
	 * @brief Returns the action
	 **/
	const ActionBase & action() const;
	/**
	 * @brief Changes the action
	 **/
	void action(ActionBase & value);
	string text() const;
private:
	ButtonStatus _status;
	ActionBase _action;
protected:
	string _text;
};

}

#endif // YEP_UI_BUTTON_BASE_HPP
